home *** CD-ROM | disk | FTP | other *** search
- -- stack: in
- -- format: 8 (HyperCard 1)
- -- flags: 0x0 (none)
- -- protect password hash: 0
- -- maximum user level: 5 (scripting)
- -- window: Rect(x1=0, y1=0, x2=0, y2=0)
- -- screen: Rect(x1=0, y1=0, x2=0, y2=0)
- -- card dimensions: w=0 h=0
- -- scroll: x=0 y=0
- -- background count: 4
- -- first background id: 2761
- -- card count: 20
- -- first card id: 2944
- -- list block id: 2093
- -- print block id: 0
- -- font table block id: 0
- -- style table block id: 0
- -- free block count: 8
- -- free size: 4032 bytes
- -- total size: 40960 bytes
- -- stack block size: 8192 bytes
- -- created by hypercard version: 0x00000000
- -- compacted by hypercard version: 0x00000000
- -- modified by hypercard version: 0x00000000
- -- opened by hypercard version: 0x00000000
- -- patterns[0]: 0x0000000000000000
- -- patterns[1]: 0x8000000008000000
- -- patterns[2]: 0x8800220088002200
- -- patterns[3]: 0x8888222288882222
- -- patterns[4]: 0x88AA22AA88AA22AA
- -- patterns[5]: 0xCCAA33AACCAA33AA
- -- patterns[6]: 0xEEAABBAAEEAABBAA
- -- patterns[7]: 0xEEBBBBEEEEBBBBEE
- -- patterns[8]: 0xFFBBFFEEFFBBFFEE
- -- patterns[9]: 0xFFBBFFFFFFBBFFFF
- -- patterns[10]: 0x8010022001084004
- -- patterns[11]: 0xFFFFFFFFFFFFFFFF
- -- patterns[12]: 0x8822882288228822
- -- patterns[13]: 0x1122448811224488
- -- patterns[14]: 0xC4800C6843023026
- -- patterns[15]: 0xB130031BD8C00C8D
- -- patterns[16]: 0xAA00AA00AA00AA00
- -- patterns[17]: 0x8822552288225522
- -- patterns[18]: 0x8855225588552255
- -- patterns[19]: 0x77DD77DD77DD77DD
- -- patterns[20]: 0x8000000000000000
- -- patterns[21]: 0xAA55AA55AA55AA55
- -- patterns[22]: 0x038448300C020101
- -- patterns[23]: 0x8244394482010101
- -- patterns[24]: 0x8814224188412214
- -- patterns[25]: 0x8080413E080814E3
- -- patterns[26]: 0x22048C7422179810
- -- patterns[27]: 0xBE808808EB088880
- -- patterns[28]: 0x25C8328964244C92
- -- patterns[29]: 0xA29C41BE2AC914EB
- -- patterns[30]: 0x40A00000040A0000
- -- patterns[31]: 0x8040200002040800
- -- patterns[32]: 0xAA00800088008000
- -- patterns[33]: 0xFF80808080808080
- -- patterns[34]: 0x081C22C180010204
- -- patterns[35]: 0xFF808080FF080808
- -- patterns[36]: 0xF87422478F172271
- -- patterns[37]: 0xBF00BFBFB0B0B0B0
- -- patterns[38]: 0xFF7FBE5DA2418000
- -- patterns[39]: 0xFAF5FAF5A050A050
- -- checksum: 0x0
- ----- HyperTalk script -----
- on idle
- set lockscreen to false
- end idle
- function getLine fileName
- -- read one line from the file
- read from file fileName until return
- put it into msg
- return (it)
- end getLine
- function terminator thisLine
- -- is thisLine a message terminator?
- global terminators
- if char 1 to 5 of thisLine is "Topic" and char 10 of thisLine is ":" then return true
- repeat with i = 1 to number of lines in terminators
- if line i of terminators is in thisLine then return true
- end repeat
- return false
- end terminator
- function getNum thisLine
- -- crack the leading number from a contents line
- put offset(":", thisLine) into endHere
- return value(char 1 to endHere - 1 of thisLine)
- end getNum
- function insertLine theField,thisNum,thisLine
- -- figure out where the new line should go in contents
- -- blank contents?
- if bkgnd field theField is empty then
- put thisLine into bkgnd field theField
- return 1
- end if
- -- at end? (the most common case - checked first)
- if getNum(last line of bkgnd field theField) < thisNum then
- put thisLine after bkgnd field theField
- return number of lines in bkgnd field theField
- end if
- -- all right, do it the hard way
- repeat with i = 1 to number of lines in bkgnd field theField
- if thisNum < getNum(line i of bkgnd field theField) then
- put thisLine before line i of bkgnd field theField
- return i
- end if
- end repeat
- end insertLine
- on addText newText
- -- concatenate to global text object, observing size limit
- global theText, textLength
- add length(newText) to textLength
- if textLength > 29990 then exit addText
- put newText after theText
- end addText
- function slurpText fileName,discard,putHere
- -- skip null lines, build message, paste into card
- -- return terminating line for analysis
- global theText, textLength
- repeat discard
- put getline(fileName) into foo
- end repeat
- put empty into theText
- put 0 into textLength
- repeat
- -- pull in the message text
- -- done offscreen for performance reasons (no redraws)
- put getLine(fileName) into theLine
- if terminator(theLine) then exit repeat
- addText theLine
- end repeat
- put theText into bkgnd field putHere
- return theLine
- end slurpText
- on setID topicID,idLine
- -- put id of this card into hidden link field of topic header card
- if idLine is 0 then exit setID
- get the id of this card
- put it into line idLine of field "theLinks" of card id (word 3 of topicID)
- end setID
- on import
- -- don't try to understand the details without a WELL transcript!
- global terminators
- ask "Please enter name of text file:"
- if it is empty then exit import
- put it into fileName
- open file fileName
- put "Interrupt!" & return & "(r)espond" & return & "responses total." into terminators
- repeat
- put getLine(fileName) into theLine
- if theLine is empty then exit repeat
- repeat while char 1 to 5 of theLine is "Topic" and char 10 of theLine is ":"
- delete last char of theLine
- delete char 11 of theLine
- delete char 1 to 5 of theLine
- put getNum(theLine) into topicNum
- put topicNum into char 1 to 4 of theLine
- if theLine is not in field "theTopics" of card "Conference" then
- -- There is no Topic line in the Conference card
- go to card "Conference"
- put char 1 to 65 of theLine & return into theLine
- put insertLine("theTopics", topicNum, theLine) into foo
- end if
- put theLine into topicLine
- go to card ("Topic" & topicNum) of bkgnd "Topic"
- if the result is not empty then
- -- There is no Topic header card for this topic
- go to card 1 of bkgnd "Topic"
- doMenu Copy Card
- go to last card
- doMenu Paste Card
- set the name of this card to "Topic" & topicNum
- put theLine into bkgnd field "theTopic"
- -- read author line
- put getLine(fileName) into theLine
- if char 1 to 4 of theLine is "By: " then
- -- This is originator's message
- delete char 1 to 4 of theLine
- put offset(")", theLine) into endHere
- put char 1 to endHere of theLine into bkgnd field "theOriginator"
- delete char 1 to endHere + 4 of theLine
- put theLine into bkgnd field "theOriginDate"
- -- skip over responses line & two guaranteed blanks
- put slurpText(fileName,3,"theIntro") into theLine
- next repeat
- end if
- else
- -- read author line
- put getLine(fileName) into theLine
- end if
- -- there is (now) a header card for this Topic
- -- don't repeat existing originator's messages
- if char 1 to 4 of theLine is "By: " then next repeat
- -- look for format errors
- if char 1 of theLine is not "#" or char 5 of theLine is not ":" then next repeat
- -- reformat the line
- delete last char of theLine
- delete first char of theLine
- put getNum(theLine) into responseNum
- delete char 1 to 4 of theLine
- put offset(":", theLine) into endHere
- put char 1 to (endHere + 3) of theLine into theLine
- put responseNum & ":" before theLine
- put 0 into idLine
- -- add this line to topic index?
- if theLine is not in bkgnd field "theResponses" then
- put char 1 to 65 of theLine & return into theLine
- put insertLine("theResponses", responseNum, theLine) into idLine
- else
- repeat with i = 1 to number of lines in bkgnd field "theResponses"
- if line i of bkgnd field "theResponses" is theLine then
- put i into idLine
- exit repeat
- end if
- end repeat
- end if
- put theLine into responseLine
- get the id of bkgnd "Response"
- put it into respID
- get the id of this card
- put it into topicID
- -- go looking for a place for this response
- -- (It would be faster to just use the link from the preceding
- -- contents entry, but things would crash if someone had deleted
- -- the response manually leaving a broken link!)
- set lockscreen to true
- repeat
- go to next card
- get the ID of this bkgnd
- if it is respID then
- -- if number matches, we already have this one
- if bkgnd field "theResponseNum" is responseNum then
- setID topicID,idLine
- exit repeat
- end if
- -- haven't counted far enough, keep going
- if bkgnd field "theResponseNum" < responseNum then next repeat
- end if
- -- either at end of cards for this topic, or found the right place
- go to prev card
- set lockscreen to false
- push card
- go to first card of bkgnd "Response"
- doMenu Copy Card
- pop card
- doMenu Paste Card
- -- fill in the card header
- put topicLine into bkgnd field "theTopic"
- put responseNum into bkgnd field "theResponseNum"
- put responseLine into bkgnd field "theResponseLine"
- put slurpText(fileName,1,"theText") into theLine
- setID topicID,idLine
- exit repeat
- end repeat
- set lockscreen to false
- end repeat
- end repeat
- close file fileName
- end import
-
-